Detect if Word file already open?

Not being familiar with OLE capabilities, ...

Can anyone advise if it is possible within a DXL script to test if a specific Word file is already open?

(My script wants to overwrite the file, so it must not be open or my script will fail.)

Thanks.


strathglass - Thu Jul 06 14:03:42 EDT 2017

Re: Detect if Word file already open?
pommCannelle - Fri Jul 07 12:55:10 EDT 2017

Have you tried to use the noError perm ?
So you can 'try' to overwrite your file ... ;) 

Something like 

Stream stest

noError
stest = write( "YOUR FILE PATH HERE" ) 
string errmess = lastError
if ( ! null errmess ) {
    ADD YOUR FAILURE CODE HERE
} else {
    ADD YOUR OK CODE HERE
}
Enjoy ;)

)

Re: Detect if Word file already open?
strathglass - Fri Jul 07 12:57:33 EDT 2017

pommCannelle - Fri Jul 07 12:55:10 EDT 2017

Have you tried to use the noError perm ?
So you can 'try' to overwrite your file ... ;) 

Something like 

Stream stest

noError
stest = write( "YOUR FILE PATH HERE" ) 
string errmess = lastError
if ( ! null errmess ) {
    ADD YOUR FAILURE CODE HERE
} else {
    ADD YOUR OK CODE HERE
}
Enjoy ;)

)

That looks like it would be a nice way to make it work, thanks! 

I will give it a try.